fix(search): use all memory_types in search API instead of only first one#104
Open
r266-tech wants to merge 1 commit intoEverMind-AI:mainfrom
Open
fix(search): use all memory_types in search API instead of only first one#104r266-tech wants to merge 1 commit intoEverMind-AI:mainfrom
r266-tech wants to merge 1 commit intoEverMind-AI:mainfrom
Conversation
… one Previously, all retrieval methods (keyword, vector, hybrid, RRF, agentic) only used memory_types[0], silently ignoring all other types in the list. If the first type was unsupported (e.g. profile), the entire search errored out. Changes: - get_keyword_search_results: iterate over ALL memory_types, search each supported type via ES_REPO_MAP, skip unsupported types with info log, merge results - get_vector_search_results: compute embedding ONCE, iterate over ALL memory_types, search each supported Milvus repo, skip unsupported types, merge results (foresight special params handled per-type) - Add module-level MILVUS_REPO_MAP dict for cleaner repo lookup - Add _memory_types_label() helper for metrics/logging across all methods - _to_response uses joined memory types string for metadata Also adds comprehensive unit tests covering multi-type search, unsupported type skipping, single type backward compatibility, and embedding-once verification. Closes EverMind-AI#78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #78 — Search API only uses
memory_types[0], silently ignoring all other types.Problem
All retrieval methods (
get_keyword_search_results,get_vector_search_results,_search_hybrid,_search_rrf,retrieve_mem_agentic) hardcodedmemory_types[0]:Impact:
memory_types=episodic_memory,foresight→ onlyepisodic_memoryis searched.foresightsilently ignored.memory_types=profile,episodic_memory→profile(not in ES/Milvus) taken as[0]→ ERROR. All valid types never searched.Fix
get_keyword_search_resultsmemory_typesES_REPO_MAP→ search if supported, skip withlogger.infoif notget_vector_search_resultsmemory_typesMILVUS_REPO_MAP→ search if supported, skip withlogger.infoif notInfrastructure
MILVUS_REPO_MAPdict (mirrors existingES_REPO_MAP)_memory_types_label()helper for metrics/logging (returns comma-joined types string)_to_responsemetadata to use joined types instead of just first typeWhat is NOT changed
RetrieveMemResponse) unchangedprofiletype remains intentionally unsearchable (MongoDB-only, fetch API)Tests
Added
tests/test_memory_manager_search.pywith 15 unit tests:TestMemoryTypesLabelTestGetKeywordSearchResultsTestGetVectorSearchResults